home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / jcool01.zip / EX3_10.C < prev    next >
C/C++ Source or Header  |  1992-08-20  |  1KB  |  33 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12.  
  13. #include <cool/Bignum.h>            // Include Bignum class
  14.  
  15. int main (void) {
  16.   CoolBignum b1;                // Create CoolBignum object
  17.   CoolBignum b2 = "0xFFFFFFFF";            // Create CoolBignum object
  18.   CoolBignum b3 = "12345e30";            // Create CoolBignum object
  19.   cout << "b2 = " << b2 << "\n";        // Display value of b2
  20.   cout << "b3 = " << b3 << "\n";        // Display value of b3
  21.   b1 = b2 + b3;                    // Add b2 and b3
  22.   cout << "b2 + b3 = " << b1 << "\n";        // Display result
  23.   b1 = b2 - b3;                    // Subtract b3 from b2
  24.   cout << "b2 - b3 = " << b1 << "\n";        // Display result
  25.   b1 = b2 * b3;                    // Multiply b2 and b3
  26.   cout << "b2 * b3 = " << b1 << "\n";        // Display result
  27.   b1 = b3 / b2;                    // Divide b2 into b3
  28.   cout << "b3 / b2 = " << b1 << "\n";        // Display result
  29.   b1 = b3 % b2;                    // Get b3 modulo b2
  30.   cout << "b3 % b2 = " << b1 << "\n";        // Display result
  31.   return 0;                    // Exit with status code
  32. }
  33.